package com.cyw.common.utils.converter;

import com.cyw.common.utils.DateUtils;
import org.springframework.core.convert.converter.Converter;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * @Author: sxw
 * @Date: 2020/9/22
 * @Desc: 字符串时间转换成 {@link LocalTime}类型
 */
public class LocalTimeConverter implements Converter<String, LocalTime> {

    @Override
    public LocalTime convert(String source) {
        return LocalTime.parse(source, DateTimeFormatter.ofPattern(DateUtils.DEFAULT_PATTERN_HMS));
    }
}
